FROM python:3.12-slim

ENV SERVICE_NAME=shopify-admin-service

# 声明构建参数（CODE_ENV），默认值为dev
ARG CODE_ENV=dev
# pip lib库ip地址
ARG PIP_LIB=172.31.16.6

# 配置 pip 使用本地 Nexus 仓库作为默认源
RUN pip config set global.index-url http://${PIP_LIB}:8071/repository/pypi-group/simple && \
    pip config set global.trusted-host ${PIP_LIB}

RUN pip install --no-cache-dir uv -i http://${PIP_LIB}:8071/repository/pypi-group/simple

WORKDIR /${SERVICE_NAME}
COPY . /${SERVICE_NAME}

#copy code enviroment
RUN cp .env.example.$CODE_ENV .env

#安装依赖
RUN uv pip install . --system -i http://${PIP_LIB}:8071/repository/pypi-group/simple
RUN pip install apache-skywalking

#暴露端口
EXPOSE 8157
# 启动应用
CMD ["sw-python", "run", "-p", "python", "main.py"]